package com.example.dessertstoressm.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.dessertstoressm.Mapper.CategoryMapper;
import com.example.dessertstoressm.Service.CategoryService;
import com.example.dessertstoressm.domain.Category;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;

    @Override
    public List<Category> getCategoryList(){
        return this.categoryMapper.selectList(null);
    }

    @Override
    public Category getCategory(String categoryId){
        QueryWrapper<Category> wrapper = new QueryWrapper<>();
        wrapper.eq("catid",categoryId);
        return this.categoryMapper.selectOne(wrapper);
    }
}
